package com.design.pattern.creational.singleton.example;

/**
 * description
 *
 * @author RenQiQiang 2019/02/19 15:17
 */
public class ThreadLocalInstance {

    private static final ThreadLocal<ThreadLocalInstance> threadlocalinstance
            = new ThreadLocal<ThreadLocalInstance>(){
        @Override
        protected ThreadLocalInstance initialValue() {
            return new ThreadLocalInstance();
        }
    };

    private ThreadLocalInstance(){

    }

    public static ThreadLocalInstance getInstance(){
        return threadlocalinstance.get();
    }
}
